# $Id: PKGBUILD 184271 2013-05-05 10:45:31Z schiv $
# Maintainer: Ray Rashif <schiv@archlinux.org>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: K. Piche <kpiche@rogers.com>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>

pkgname=hydrogen
pkgver=0.9.5.1
pkgrel=4
pkgdesc="An advanced drum machine"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.hydrogen-music.org/"
depends=('libarchive' 'liblrdf' 'qt4' 'jack')
makedepends=('scons' 'optipng')
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
        'lrdf_raptor2.patch'
        'install.patch')
install=$pkgname.install
options=('emptydirs')
md5sums=('52f3a528705818c65acf546a3be4c6fb'
         '2124851e890f46158189b5fa90006d40'
         'ce3a83a069b55e46aa532b55e803c9a5')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"

  # fix building with newer raptor
  # see https://bugs.archlinux.org/task/25060
  # TODO: report upstream
  patch -Np1 -i "$srcdir/lrdf_raptor2.patch"

  # fix some install-time issues
  # http://www.assembla.com/spaces/hydrogen/tickets/204
  patch -Np0 -i "$srcdir/install.patch"

  # fix some pngs that break with newer libpng
  # see https://mailman.archlinux.org/pipermail/arch-dev-public/2013-May/024872.html
  msg2 "Fixing PNGs, please wait..."
  find -name '*.png' -exec optipng -quiet -force -fix {} +
}

build() {
  cd "$srcdir/$pkgname-$pkgver"

  export QTDIR=/usr
  scons prefix=/usr libarchive=1
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  scons DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
